package sdk.weinxin.beans.massmessage;


import sdk.weinxin.beans.massmessage.preview.MpvideoPreview;
import sdk.weinxin.beans.massmessage.preview.Preview;
import sdk.weinxin.beans.message.Media;

public class MassMPvideoMessage extends MassMessage {

    private Media mpvideo;

    public MassMPvideoMessage() {
        super();
        this.setMsgType("mpvideo");
    }

    /**
     *
     * @param media_id MessageAPI mediaUploadvideo 返回的media_id
     */
    public MassMPvideoMessage(String mediaId) {
        super();
        mpvideo = new Media(mediaId);
        this.setMsgType("mpvideo");
    }

    public Media getMpvideo() {
        return mpvideo;
    }

    public void setMpvideo(Media mpvideo) {
        this.mpvideo = mpvideo;
    }

    @Override
    public Preview convert() {
        Preview preview = new MpvideoPreview(mpvideo.getMediaId());
        if (this.getToUser() != null && this.getToUser().size() > 0) {
            preview.setToUser(this.getToUser().iterator().next());
        }
        return preview;
    }
}
